﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.AI;

namespace CharacterSystem
{
    public class NavigateMesh:INavicater
    {
        private NavMeshAgent agent;

        public NavigateMesh(GameObject go)
        {
            agent = go.GetComponent<NavMeshAgent>();
            if (agent == null) 
            {
                agent = go.AddComponent<NavMeshAgent>();
            }
        }

        public void SetDestination(Vector3 pos)
        {
            agent.SetDestination(pos);
        }

        public void SetAreaMask(int mask)
        {
            agent.areaMask = mask;
        }
    }
}
